package com.springboot.demo.singleton;

/**
 * dcl实现单例
 *
 * @author supu
 * @date 2020-04-11 16:40
 **/
public class SingletonDcl {
    private static volatile SingletonDcl singletonDcl;

    public static SingletonDcl getInstance() {
        if (singletonDcl == null) {
            synchronized (SingletonDcl.class) {
                if (singletonDcl == null) {
                    singletonDcl = new SingletonDcl();
                }
            }
        }
        return singletonDcl;
    }
}
